@{
    Layout = "~/Views/Shared/_Dashboard.cshtml";
        var _profile = Context.Profile;
        var _user=Membership.GetUser(_profile.UserName);
        var _context = WebSiteContext.Current;
}

@UIHelper.ImageTitle(_user.GetDisplayName(),(_profile["Signature"] !=null) ? _profile["Signature"] as string:"",_user.GetAvatar(48))
@using (Html.BeginForm())
{


    Ajax.Dna().Tabs()
      .Options(opts =>
      {
          opts.OnTabSelected = "if (ui.index==2) $(\"#Signature\").richtextbox(\"active\");";
          opts.Animations = new { opacity = "toggle", height = "toggle", width = "toggle" };
      })
      .Views(views =>
      {
          views.Add(Html.Global("RES_PROFILE"))
              .Template(@<text>
    <table class="d-field-table" cellspacing="0px">
        <tr>
            <td>
                @Html.Global("RES_USER_NAME"):
            </td>
            <td>
                @_profile.UserName
            </td>
        </tr>
        <tr>
            <td>
                @Html.Global("RES_EMAIL"):
            </td>
            <td>
                @Membership.GetUser().Email
            </td>
        </tr>
        <tr>
            <td>
                <label for="username">
                    @Html.Global("RES_USER_DISPLAYNAME"):</label>
            </td>
            <td>
                @(Ajax.Dna().TextBox("DisplayName")
                                  .HtmlAttributes(new { tabIndex = 0 })
                                  .Value(_profile["DisplayName"].ToString())
                                  .Width(300)
                                  .IconImageUrl(Url.Content("~/content/images/icon_contact_16.gif"))
                                  .GetHtml()
                )
            </td>
        </tr>
        <tr>
            <td>
                <label for="Language">
                    @Html.Global("RES_LANGUAGE"):</label>
            </td>
            <td>
                @(Ajax.DnaFor().ComboBox(_context.Languages, l => l.Title, l => l.Value)
                           .DropDownStyle(DropdownStyles.DropdownList)
                           .Width(250)
                           .Select(_profile["Language"].ToString())
                           .Name("Language")
                           .GetHtml()
                )
            </td>
        </tr>
        <tr>
            <td>
                @Html.Global("RES_TIMEZONE"):
            </td>
            <td>
                @(Ajax.DnaFor().ComboBox(_context.TimeZones, z => z.Title, z => z.Value)
                           .DropDownStyle(DropdownStyles.DropdownList)
                           .Width(250)
                           .Select(_profile["TimeZone"].ToString())
                           .Name("TimeZone")
                           .GetHtml()
                )
            </td>
        </tr>
        <tr>
            <td>
                <label for="Location">
                    @Html.Global("RES_LOCATION"):</label>
            </td>
            <td>
                @( Ajax.Dna().TextBox("Location")
                   .Value(_profile["Location"].ToString())
                   .IconImageUrl(Url.Content("~/content/images/icon_earth_16.gif"))
                   .GetHtml()
                   )
            </td>
        </tr>
        <tr>
            <td>
                <label for="Phone">
                    @Html.Global("RES_PHONE"):</label>
            </td>
            <td>
                @Ajax.Dna().TextBox("Phone").Value(_profile["Phone"].ToString()).GetHtml()
            </td>
        </tr>
        <tr>
            <td>
                <label for="Mobile">
                    @Html.Global("RES_MOBILE"):</label>
            </td>
            <td>
                @Ajax.Dna().TextBox("Mobile").Value(_profile["Mobile"].ToString()).GetHtml()
            </td>
        </tr>
        <tr>
            <td>
                <label for="birthday">
                    @Html.Global("RES_BIRTHDAY"):</label>
            </td>
            <td>
                @(Ajax.Dna().DatePicker("Birthday")
                           .Options(opts =>
                           {
                               opts.AllowChangeMonth = true;
                               opts.AllowChangeYear = true;
                           })
                           .Value((DateTime)_profile["Birthday"])
                           .GetHtml()
                )
            </td>
        </tr>
        <tr>
            <td>
                <label for="birthday">
                    @Html.Global("RES_ADDRESS"):</label>
            </td>
            <td>
                @(Ajax.Dna().TextArea("Address")
                           .Width(300)
                           .Resizable()
                           .Value(_profile["Address"].ToString())
                           .GetHtml()
                )
            </td>
        </tr>
    </table>
    </text>);
          views.Add(Html.Global("RES_CONTACTINFO")).Template(@<text>
    <table class="d-field-table" cellspacing="0px">
        <tr>
            <td>
                <label for="Email">
                    @Html.Global("RES_EMAIL"):</label>
            </td>
            <td>
                @(
 Ajax.Dna().TextBox("Email")
                        .Width(300)
                        .Value(_profile["Email"].ToString())
                        .IconImageUrl(Url.Content("~/content/images/icon_mail_16.png"))
                        .GetHtml()
                )
            </td>
        </tr>
        <tr>
            <td>
                <label for="Blog">
                    @Html.Global("RES_BLOG"):</label>
            </td>
            <td>
                @Ajax.Dna().TextBox("Blog").Width(300).Value(_profile["Blog"].ToString()).IconCssClass("forum-icon forum-icon-blog").GetHtml()
            </td>
        </tr>
        <tr>
            <td>
                <label for="WebSite">
                    @Html.Global("RES_WEBSITE"):</label>
            </td>
            <td>
                @Ajax.Dna().TextBox("WebSite").Value(_profile["WebSite"].ToString()).Width(300).IconCssClass("forum-icon forum-icon-web").GetHtml()
            </td>
        </tr>
        <tr>
            <td>
                <label for="Facebook">
                    Facebook:</label>
            </td>
            <td>
                @Ajax.Dna().TextBox("Facebook").Value(_profile["Facebook"].ToString()).Width(300).IconImageUrl(Url.Content("~/content/images/icon_facebook_16.png")).GetHtml()
            </td>
        </tr>
        <tr>
            <td>
                <label for="Twitter">
                    Twitter:</label>
            </td>
            <td>
                @Ajax.Dna().TextBox("Twitter").Value(_profile["Twitter"].ToString()).Width(300).IconImageUrl(Url.Content("~/content/images/icon_twitter_16.png")).GetHtml()
            </td>
        </tr>
                <tr>
            <td>
                <label for="Gravatar">
                    Gravatar:</label>
            </td>
            <td>
                @Ajax.Dna().TextBox("Gravatar").Value(_profile["Gravatar"].ToString()).Width(300).IconImageUrl(Url.Content("~/content/images/icon_gravatar_16.jpg")).GetHtml()
            </td>
        </tr>
        <tr>
            <td>
                <label for="Yahoo">
                    @Html.Global("RES_YAHOO"):</label>
            </td>
            <td>
                @Ajax.Dna().TextBox("Yahoo").Value(_profile["Yahoo"].ToString()).Width(300).IconCssClass("forum-icon forum-icon-yahoo").GetHtml()
            </td>
        </tr>
        <tr>
            <td>
                <label for="MSN">
                    @Html.Global("RES_MSN"):</label>
            </td>
            <td>
                @Ajax.Dna().TextBox("Msn").Value(_profile["MSN"].ToString()).Width(300).IconCssClass("forum-icon forum-icon-msn").GetHtml()
            </td>
        </tr>
        <tr>
            <td>
                <label for="MSN">
                    @Html.Global("RES_ICQ"):</label>
            </td>
            <td>
                @Ajax.Dna().TextBox("ICQ").Value(_profile["ICQ"].ToString()).Width(300).IconCssClass("forum-icon forum-icon-icq").GetHtml()
            </td>
        </tr>
    </table>
    </text>);
          views.Add(Html.Global("RES_SIGNATURE"))
.Template(() =>
{
    Ajax.Dna().RichTextBox("Signature")
              .AllowHTMLEditing(false)
              .Width(760)
              .Value(string.IsNullOrEmpty(_profile["Signature"] as string) ? "" : _profile["Signature"].ToString())
              .Render();
});
          views.Add(Html.Global("RES_AVATAR"))
            .Template(@<text>
    <table cellspacing="0px" class="d-content">
        <tr>
            <td valign="top" align="center">
                @Html.Global("RES_AVATAR")
            </td>
        </tr>
        <tr>
            <td align="center">
                <img id="AvatarPreview" src="@(string.IsNullOrEmpty(_profile["Avatar"].ToString()) ? Url.Content("~/content/images/no-avatar.gif") : _profile["Avatar"].ToString())" alt="" style="width: 90px; height: 90px;" />
                @Html.Hidden("Avatar", _profile["Avatar"].ToString())
            </td>
        </tr>
        <tr>
            <td align="center">
            @Ajax.Dna().Button("btnResetAvatar").LocText("RES_DELETE").Click("$('#Avatar').val('');$('#AvatarPreview').attr('src','" + Url.Content("~/content/images/no-avatar.gif") + "');").GetHtml()
            </td>
        </tr>
        <tr>
            <td style="height: 200px;" valign="top">
                @(
 Ajax.Dna().ImageFileListBox("AvatarListView", Url.Action("GetFiles", "WebFiles", new { Area = "", url = _context.ApplicationPath + "/webshared/home/images/avatars" }), "POST")
                        .Options(opts =>
                        {
                            opts.IsInlineMode = true;
                            opts.OnItemSelected = "$('#Avatar').val(ui.value);$('#AvatarPreview').attr('src',ui.value);";
                        })
                        .Width(780)
                        .Height(200).GetHtml()
                        )
            </td>
        </tr>
    </table>
    </text>);
      })
      .Render();

    <div style="margin-top: 10px; height: 40px; text-align: center;">
        @Ajax.Dna().Button("btnSubmit").Submit().LocText("RES_SAVE").ImageIcons(Url.Content("~/content/images/icon_save.gif")).GetHtml()
    </div>
}
@Html.StartupScripts()
